package cn.fbs.service;

import cn.fbs.dao.dm.DMDataInfoMapper;
import cn.fbs.model.TDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class DataService {
    @Autowired
    private DMDataInfoMapper mapper;
    public List<TDataInfo> findAll() {
        List<TDataInfo> list = mapper.selectAll();
         System.out.println(" findAll");
        return list;
    }
    public void insert(TDataInfo dataInfo) {
 System.out.println("insert_end");
        mapper.insertSelective(dataInfo);
    }
    public void update(TDataInfo dataInfo) {
        dataInfo.setUpdateDate(new Date());
         System.out.println("update_end");
        mapper.updateByPrimaryKeySelective(dataInfo);
    }
    public void delete(Long primaryKey) {
         System.out.println("delete_end");  mapper.deleteByPrimaryKey(primaryKey);
    }
    public TDataInfo selectByPrimaryKey(Long primaryKey){
         System.out.println("selectByPrimaryKey_end");
        return mapper.selectByPrimaryKey(primaryKey);
    }

    public List<TDataInfo> likeQuery(String fileName) {
         System.out.println("likeQuery_end");  return mapper.likeQuery(fileName);
    }


    public TDataInfo getDataItem(Long id){
         System.out.println("getDataItem_end");
        TDataInfo tDataInfo = mapper.selectByPrimaryKey(id);
        return tDataInfo;
    }
}
